
<script type="text/javascript">
var dataOptions = new Object();
$(function(){	
	$.get("parameterCard/getCardInfo",function(data){
		var contentb="<option value='' selected>请选择</option>";
		var html_cardTCode = data.cardTypeCode;
		var html_cardpCode = data.cardpCode;
		var currentPage = data.currentPage;
		var numPerPage = data.numPerPage;
		var pageCount = data.pageCount;
		if(currentPage&&numPerPage&&pageCount){
			dataOptions["currentPage"]=currentPage;
			dataOptions["numPerPage"]=numPerPage;
			dataOptions["pageCount"]=pageCount;
		}
		if(html_cardpCode){
			contentb="<option value=''>请选择</option>";
			dataOptions["cardpCode"]= html_cardpCode;
		}
		var i;
		$(data).each(function(n,item){
			for(i=0;i<item.cdProDefinitions.length;i++){
				if(item.cdProDefinitions[i].cardpCode==item.cardpCode){
					contentb+="<option value="+item.cdProDefinitions[i].cardpCode+" selected>"
					+item.cdProDefinitions[i].cardpName+"</option>"
				}else{
					contentb+="<option value="+item.cdProDefinitions[i].cardpCode+">"
					+item.cdProDefinitions[i].cardpName+"</option>"
				}
			}
			//全选按钮初始化，如果之前选中了，清除
			$("#cardpCodeByCardDis").html(contentb);
		});
		//$("input[name='branchNo']").val("007");
		//$("input[name='operatorNo']").val("333");
	},"json");
	$.post("tellerManage/getpaperAndBranch",function(json){
		 var contentb="<option value='' >请选择</option>";
		 $(json).each(function(n,item){
			for(i=0;i<item.branchs.length;i++){
				contentb+="<option value="+item.branchs[i].orgName+">"
				+item.branchs[i].orgName+"</option>"
			};
			$("#branchNoByCardDis").html(contentb);
		 });
		
	 },"json")
	$("#queryToDistributeTaskInfo").click(function(){
		//验证任务编号
		//验证任务名称
		$("input[name='pageNum']").val("1");
		console.log("pageNum==>"+$("input[name='pageNum']").val());
		
	});
	})
$(function(){
	$.post("inventoryDistributionMagOfCenter/getDistributionDetail",getDistributionDetail,"json");
//	document.getElementById('table_id').style.display='none';
});

$("#distributeCreate").click(function(){
	if($("input[name='distributionTasked']:checked").length < 1){
		 alertMsg.warn("您未选择数据！")	
		 return false;
	}
	//判断选中的数据是否是同一个申请网点
	var branch = "";
	var flag = 1;
	$($("input[name='distributionTasked']:checked")).each(function(n,item){
		var valueArray = $(item).val().split("#");
	//	console.log("branch==>"+branch);
		var temp = valueArray[1];
	//	console.log("temp==>"+temp);
		if(branch){
	//		console.log("branch不为空");
			if(temp!=branch){
				flag = 0;
				return false;
			}
		}
		
		branch = valueArray[1];	
	});
//	console.log("flag==>"+flag);
	if(flag==0){
		alertMsg.warn("请选择相同的网点配送！")	
		return false;
	}	
})

</script>	

<div class="pageHeader ">
	<form id="pagerForm" method="post" action="inventoryDistributionMagOfCenter/getDistributionDetail" class="pageForm required-validate" onsubmit="return validateCallback(this,getDistributionDetail);">
		<input type="hidden" name="pageNum" value="" /> 
		<input type="hidden" name="numPerPage" value="" />
		<!-- <input type="hidden" name="pageCount" value="" /> -->
		<!-- <input type="hidden" name="orderField" value="${param.orderField}" />
		<input type="hidden" name="orderDirection" value="${param.orderDirection}" /> -->
		<div class="searchBar">
		<table class="searchContent">
			<tr>
				<td><label>卡产品：</label></td>
				<td style="text-align:left"><select id="cardpCodeByCardDis" name="cardpCode"></select></td>
			</tr>
			<tr>
				<td><label>申请网点：</label></td>
				<td style="text-align:left">
				<select id="branchNoByCardDis" name="applyBranchNo"  class="" >
				</select>
				</td>
			</tr>
			<tr>
				<td><label>任务编号：</label></td>
				<td><input  name="taskNo" class="validTaskNo" type="text" size="30" /></td>
			</tr>
			<tr>
				<td><label>任务名称：</label></td>
				<td><input  name="taskName" class="validApplyNo" type="text" size="30"  /></td>
			</tr>
			<tr>
				<td><label>网点编号：</label></td>
				<td><input name="branchNo" class="" type="text" size="30"  readonly="readonly" unselectable="on"/></td>		
			</tr>
			<tr>
				<td><label>员工编号：</label></td>
				<td><input  name="operatorNo" class="" type="text" size="30"  readonly="readonly" unselectable="on"/></td>		
			</tr>
			</table>
		<div class="subBar">
			<ul> 
				<li>
				<div class="buttonActive" ><div class="buttonContent" ><button id="queryToDistributeTaskInfo" type="submit">查询</button></div></div>
				</li>
			</ul>
		</div>
		</div>
	</form>	
</div>


<div class="pageContent" >
<form method="post" action="inventoryDistributionMagOfCenter/toCardDisRegister" class="pageForm required-validate" onsubmit="return validateCallback(this,navTabAjaxDone);" >

		<!-- <input id="bankName" name="bankName" type="hidden" value="">
		<input id="companyName" name="companyName" type="hidden" value=""> -->
	 
	 <div id="cardDistribution">
		<table class="table" width="1000" >
			<thead>
				<tr>
					<th width="6%"><input type="checkbox" id="ids" name="tasking" group="distributionTasked" class="checkboxCtrl"></th>
					<th width="3%" >序号</th>
					<th width="8%" >卡产品</th>
					<th width="8%" >申请网点</th>
					<th width="24%" >任务编号</th>
					<th width="8%" >任务名称</th>
					<th width="5%" >总数量</th>
                    <th width="8%" >可配送数量</th>
					<th width="10%" >任务生成日期</th>
                    <th width="8%" >入库日期</th>  
                    <th width="0%" style="display:none">卡产品代码</th> 
                    <th width="0%" style="display:none">制卡号</th> 
                    <th width="0%" style="display:none">供应商</th>         
				</tr>
			</thead>
			<tbody id="distributionTask">
			</tbody>			
		</table>
		</div>
	<!--  <div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select id="numPerPageByIM" name="numPerPage" onchange="paging()">
				<option value="10">10</option>
				<option value="20">20</option>
				<option value="50">50</option>
				<option value="100">100</option>
			</select>
			<span id="totalCountByDT" ></span>
		</div>
		<div class="pagination" targetType="navTab" totalCount="200" numPerPage="20" pageNumShown="10" currentPage="1"></div>
			<div id="paginationByDT" class="pagination1"  ></div>
	</div> -->
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value},'distributionTask',getDistributionDetail)">
				<option value="10">10</option>
				<option value="20">20</option>
				<option value="50">50</option>
				<option value="100">100</option>
			</select>
			<span id="totalCountByDT">条，共${totalCount}条</span>
		</div>

		<div callback='getDistributionDetail' id="paginationByProduct" rel="distributionTask" class="pagination" targetType="navTab" totalCount="200" numPerPage="5" pageNumShown="5" currentPage="1"></div>

	</div>
	<div class="formBar">
			<!-- <ul> 
				<li>
					<a class="buttonActive" href="inventorymanagement/cardDetail" target="navTab" rel="cardDistribution" title="详情"><span>详情</span></a>
				</li>
			</ul> -->
			<ul>
				<li>
				<div class="buttonActive" ><div class="buttonContent" ><button id="distributeCreate"  type="submit">配送</button></div></div>
				</li>				
			</ul>
	</div>

</form>
</div>

	



